# Contributor: Kevin Daudt <kdaudt@alpinelinux.org>
# Maintainer: Kevin Daudt <kdaudt@alpinelinux.org>
pkgname=tmuxinator
pkgver=3.2.0
pkgrel=0
pkgdesc="manage complex tmux sessions easily"
url="https://github.com/tmuxinator/tmuxinator"
arch="noarch"
license="MIT"
depends="tmux ruby ruby-erubi ruby-thor ruby-xdg"
checkdepends="ruby-rspec"
options="!check" # requires coveralls
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/tmuxinator/tmuxinator/archive/v$pkgver/tmuxinator-$pkgver.tar.gz
	tmuxinator-use-new-xdg-version.patch
	"

build() {
	gem build tmuxinator.gemspec
}

check() {
	rspec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		tmuxinator

	install -Dm0644 completion/tmuxinator.bash \
		"$pkgdir"/usr/share/bash-completion/completions/tmuxinator
	install -Dm0644 completion/tmuxinator.fish \
		"$pkgdir"/usr/share/fish/vendor_completions.d/tmuxinator.fish
	install -Dm0644 completion/tmuxinator.zsh \
		"$pkgdir"/usr/share/zsh/site-functions/_tmuxinator

	rm -r "$gemdir"/cache \
		"$gemdir"/extensions \
		"$gemdir"/doc \
		"$gemdir"/gems/tmuxinator-$pkgver/spec
}

sha512sums="
d9258405b2aef18c17f8f4dcf8625d3d86d1b8133322cf18875ebcce1c4379f19b741cc34e885056b44dc59f06dd4d4c9b962488b3fedfca41d13bf784c2f4f0  tmuxinator-3.2.0.tar.gz
1c6d0e708301662e2175c6c5c67658683af5135fd0a1bb156a18159f4a59e65e466a8c2434b8236c56ae99708f54a2451ffdec281109218291cf8e89f39f192f  tmuxinator-use-new-xdg-version.patch
"
